Optimal. Leaf size=70 \[ -\frac {3 x}{2 a}-\frac {3 \cot (c+d x)}{2 a d}-\frac {i \log (\sin (c+d x))}{a d}+\frac {\cot (c+d x)}{2 d (a+i a \tan (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.07, antiderivative size = 70, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 24, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3633, 3610,
3612, 3556} \begin {gather*} -\frac {3 \cot (c+d x)}{2 a d}-\frac {i \log (\sin (c+d x))}{a d}+\frac {\cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {3 x}{2 a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3610
Rule 3612
Rule 3633
Rubi steps
\begin {align*} \int \frac {\cot ^2(c+d x)}{a+i a \tan (c+d x)} \, dx &=\frac {\cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {\int \cot ^2(c+d x) (-3 a+2 i a \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac {3 \cot (c+d x)}{2 a d}+\frac {\cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {\int \cot (c+d x) (2 i a+3 a \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac {3 x}{2 a}-\frac {3 \cot (c+d x)}{2 a d}+\frac {\cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {i \int \cot (c+d x) \, dx}{a}\\ &=-\frac {3 x}{2 a}-\frac {3 \cot (c+d x)}{2 a d}-\frac {i \log (\sin (c+d x))}{a d}+\frac {\cot (c+d x)}{2 d (a+i a \tan (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(286\) vs. \(2(70)=140\).
time = 0.71, size = 286, normalized size = 4.09 \begin {gather*} \frac {\csc \left (\frac {c}{2}\right ) \csc (c+d x) \sec \left (\frac {c}{2}\right ) \sec (c+d x) \left (8 \cos (c)-9 \cos (c+2 d x)+2 i d x \cos (c+2 d x)+\cos (3 c+2 d x)-2 i d x \cos (3 c+2 d x)-2 \cos (c+2 d x) \log \left (\sin ^2(c+d x)\right )+2 \cos (3 c+2 d x) \log \left (\sin ^2(c+d x)\right )+10 i \sin (c)-4 d x \sin (c)-4 i \log \left (\sin ^2(c+d x)\right ) \sin (c)+16 i \text {ArcTan}(\tan (d x)) \sin (c) (\cos (c+d x)+i \sin (c+d x)) \sin (c+d x)-7 i \sin (c+2 d x)-2 d x \sin (c+2 d x)-2 i \log \left (\sin ^2(c+d x)\right ) \sin (c+2 d x)-i \sin (3 c+2 d x)+2 d x \sin (3 c+2 d x)+2 i \log \left (\sin ^2(c+d x)\right ) \sin (3 c+2 d x)\right )}{32 a d (-i+\tan (c+d x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.24, size = 68, normalized size = 0.97
method | result | size |
derivativedivides | \(\frac {\frac {5 i \ln \left (\tan \left (d x +c \right )-i\right )}{4}-\frac {1}{2 \left (\tan \left (d x +c \right )-i\right )}-\frac {1}{\tan \left (d x +c \right )}-i \ln \left (\tan \left (d x +c \right )\right )-\frac {i \ln \left (\tan \left (d x +c \right )+i\right )}{4}}{d a}\) | \(68\) |
default | \(\frac {\frac {5 i \ln \left (\tan \left (d x +c \right )-i\right )}{4}-\frac {1}{2 \left (\tan \left (d x +c \right )-i\right )}-\frac {1}{\tan \left (d x +c \right )}-i \ln \left (\tan \left (d x +c \right )\right )-\frac {i \ln \left (\tan \left (d x +c \right )+i\right )}{4}}{d a}\) | \(68\) |
risch | \(-\frac {5 x}{2 a}-\frac {i {\mathrm e}^{-2 i \left (d x +c \right )}}{4 d a}-\frac {2 c}{d a}-\frac {2 i}{d a \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}-\frac {i \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d a}\) | \(78\) |
norman | \(\frac {-\frac {1}{d a}-\frac {3 x \tan \left (d x +c \right )}{2 a}-\frac {3 x \left (\tan ^{3}\left (d x +c \right )\right )}{2 a}-\frac {3 \left (\tan ^{2}\left (d x +c \right )\right )}{2 d a}-\frac {i \tan \left (d x +c \right )}{2 d a}}{\tan \left (d x +c \right ) \left (1+\tan ^{2}\left (d x +c \right )\right )}-\frac {i \ln \left (\tan \left (d x +c \right )\right )}{d a}+\frac {i \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d a}\) | \(125\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.38, size = 99, normalized size = 1.41 \begin {gather*} -\frac {10 \, d x e^{\left (4 i \, d x + 4 i \, c\right )} - {\left (10 \, d x - 9 i\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + 4 \, {\left (i \, e^{\left (4 i \, d x + 4 i \, c\right )} - i \, e^{\left (2 i \, d x + 2 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right ) - i}{4 \, {\left (a d e^{\left (4 i \, d x + 4 i \, c\right )} - a d e^{\left (2 i \, d x + 2 i \, c\right )}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.19, size = 116, normalized size = 1.66 \begin {gather*} \begin {cases} - \frac {i e^{- 2 i c} e^{- 2 i d x}}{4 a d} & \text {for}\: a d e^{2 i c} \neq 0 \\x \left (\frac {\left (- 5 e^{2 i c} - 1\right ) e^{- 2 i c}}{2 a} + \frac {5}{2 a}\right ) & \text {otherwise} \end {cases} - \frac {2 i}{a d e^{2 i c} e^{2 i d x} - a d} - \frac {5 x}{2 a} - \frac {i \log {\left (e^{2 i d x} - e^{- 2 i c} \right )}}{a d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.58, size = 91, normalized size = 1.30 \begin {gather*} -\frac {-\frac {10 i \, \log \left (\tan \left (d x + c\right ) - i\right )}{a} + \frac {2 i \, \log \left (-i \, \tan \left (d x + c\right ) + 1\right )}{a} + \frac {8 i \, \log \left (\tan \left (d x + c\right )\right )}{a} + \frac {\tan \left (d x + c\right )^{2} - 13 i \, \tan \left (d x + c\right ) - 8}{{\left (-i \, \tan \left (d x + c\right )^{2} - \tan \left (d x + c\right )\right )} a}}{8 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 3.99, size = 96, normalized size = 1.37 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,5{}\mathrm {i}}{4\,a\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{4\,a\,d}-\frac {\frac {1}{a}+\frac {\mathrm {tan}\left (c+d\,x\right )\,3{}\mathrm {i}}{2\,a}}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^2\,1{}\mathrm {i}+\mathrm {tan}\left (c+d\,x\right )\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,1{}\mathrm {i}}{a\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________